<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="https://js.arcgis.com/3.31/esri/css/esri.css">
  <link rel="stylesheet" href="https://js.arcgis.com/3.31/esri/themes/calcite/dijit/calcite.css">
  <link rel="stylesheet" href="../common/assets/styles/index.css">
  <script src="https://js.arcgis.com/3.31/"></script>
</head>

<body class="calcite">
  <div id="map" class="map">
    <div id="swipeDiv"></div>
  </div>
  <script>
    require([
      "esri/map",
      "esri/layers/ArcGISTiledMapServiceLayer",
      "esri/dijit/LayerSwipe", 
      "dojo/domReady!"
      ], function (Map, ArcGISTiledMapServiceLayer, LayerSwipe) {
      let map = new Map("map");
      let titled01 = new ArcGISTiledMapServiceLayer("http://122.224.233.66:11893/arcgis/rest/services/TXGHJG/GHYJJBNT_GHTZHYJJBNTFW/MapServer");
      let titled02 = new ArcGISTiledMapServiceLayer("http://122.224.233.66:11893/arcgis/rest/services/TDLYXZ_2019/MapServer");
      map.addLayers([titled01, titled02])
      console.log(titled01)
      var swipeWidget = new LayerSwipe({
        type: "vertical",  //Try switching to "scope" or "horizontal"
        map: map,
        layers: [titled02]
      }, "swipeDiv");
      swipeWidget.startup();

    });
  </script>
</body>

</html>